<template>
  <h2>生命周期-setup属性</h2>
  <ul>
    <li v-for="item in list" :key="item._id">{{ item.title }}</li>
  </ul>
</template>

<script setup>
import { onMounted, ref } from "vue";

const list = ref([]);

onMounted(() => {
  fetch("http://www.pudge.wang:3080/api/rated/list")
    .then((response) => response.json())
    .then((res) => {
      console.log(res);
      list.value = res.result;
    });
});
</script>
